
I=0
while [[ $I -lt 40 ]];
do
    echo $I
    #ps -A -o %cpu,rss,cmd|grep [r]eplay
    TOP=$(top -b -n 1|grep java)
    echo $TOP
    echo $TOP >> top.$1.txt 
    ((I++))
    sleep 1
done
